#ifndef LAYOUTGENOMEELEMENTS_H
#define LAYOUTGENOMEELEMENTS_H

#include <QObject>
#include <QList>
#include <QPointer>
#include <QDebug>

#include "../../VisBaseClasses/visbaselayout.h"
#include "genomeelement.h"

class VisBaseElement;

class LayoutGenomeElements : public VisBaseLayout
{
    Q_OBJECT
public:
    LayoutGenomeElements(QObject *parent = 0);
    LayoutGenomeElements(QList< QPointer< VisBaseElement > > elements, QObject *parent = 0);
    //LayoutGenomeElements( const LayoutGenomeElements& other );
    
    void setStartNt(float startNt);
    void setStopNt(float stopNt);
    void setStartX(float startX);
    void setStopX(float stopX);
    void setNtPerPixel(float ntPerPixel);

    void swapStartNtAndStopNt();
    void swapStartAndStop(int nt);
    void rotateAroundNt(int nt);

    float getNtPerPixel();
    float getStartNt();
    float getStopNt();
    float getStartX();
    float getStopX();

    void moveNt(float deltaNt);
    void resetIfOutOfBounds();

signals:
    void trackProgress(int stepsComplete);
    void finished();
    void error( QString err );

public slots:
    void process();

private:
    void init();
    float map(float nt);

    GenomeElement* getGenomeElement(int i);

    float startNt;
    float stopNt;
    float startX;
    float stopX;
    float ntPerPixel;
};

#endif // LAYOUTGENOMEELEMENTS_H
